<!DOCTYPE html>
<html>
<head>
<title>注册页面</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Bubble Login Form template Responsive, Login form web template,Flat Pricing tables,Flat Drop downs  Sign up Web Templates, Flat Web Templates, Login sign up Responsive web template, SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Custom Theme files -->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- //Custom Theme files -->
<!-- js -->
<script src="js/jquery-2.2.3.min.js"></script>
<!-- //js --> 
<!-- web font -->  
<link href="http://fonts.googleapis.com/css?family=Playfair+Display:400,400i,700,700i,900,900i" rel="stylesheet">
<link href="http://fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i" rel="stylesheet">
<!-- //web font --> 

<script>
 	function check(){
 		if(form.rno.value == ""){
 			alert("rno不能为空...");  //弹出rno不能为空
 			form.rno.focus();
 			return false;
 		}
		
 		if(form.rname.value == ""){
 			alert("rname不能为空...");  
 			form.rname.focus();
 			return false;
 		}
 		
 		if(form.password.value == ""){
 			alert("password不能为空...");  
 			form.password.focus();
 			return false;
 		}
 		var regm1 = /^[a-zA-Z_]+[a-zA-Z0-9]+$/;
 		if(!form.password.value.match(regm1)){
 			alert("密码格式错误，请以字母或者下划线开头...");
 			form.password.focus();
 			return false;
 		}
 			
 		if(form.superuser.value == ""){
 			alert("superuser不能为空...");
 			form.superuser.focus();
 			return false;
 		}
 		var regm2 = /^[2]?$/;
 		if(!form.superuser.value.match(regm2)){
 			alert("superuser只能为2，请重新输入2...");
 			form.superuser.focus();
 			return false;
 		}
 	}
 	
 	
 	function createXmlHttpRequest(){
 	    var xmlreq = false;
 	    if (window.XMLHttpRequest){
 	        xmlreq = new XMLHttpRequest();
 	    }else
 	        if (window.ActiveXObject){
 	    	try{
 	    	    xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
 	    	}catch(e1){
 	    	    try{
 	    	        xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
 	    	    }catch(e2){
 	    	    }
 	    	}
 	    }
 	    return xmlreq;   	
 	}

 	function rnameCheck(){
        var request = createXmlHttpRequest();
        var rname = document.all.rname.value;
        request.open("post","rnameCheckServlet?rname="+rname);
        request.send();
        request.onreadystatechange = function(){
    	if(request.readyState==4){
    	        var value = request.responseText;
    	        if(value=="true"){
    	                document.all.rname.value="该用户名已存在";
    	        }
        	}
        }
   }

 	
</script>

</head>
<body class="video" data-vide-bg="video/bubble">
	<!-- main -->
	<div class="main">
		<h1>Reader Register Page</h1>
		<div class="main-w3lsrow">
			<!-- login form -->
			<div class="login-form login-form-left"> 
				<div class="agile-row">
					<h2>Reader Register</h2> 
					<div class="login-agileits-top"> 	
						<form name="form" action="registerservlet" autocomplete="on" method="post"> 
						    <input type="text" id="rno" name="rno" placeholder="rno" required=""/>
						    <p>
							<input type="text" id="rname" name="rname" placeholder="rname" required="" onBlur="rnameCheck()"/>
							<p>
							<input type="password" id="password" name="password" placeholder="password" required=""/>
							<p>
							<input type="password" id="superuser" name="superuser" placeholder="superuser" required=""/>  
							<input type="submit" value="Register" onClick="return check();"> 
						</form> 	
					</div> 
				</div>  
			</div>  
		</div>	
	</div>	
	<!-- //main --> 
	<script src="js/jquery.vide.min.js"></script> 
</body>
</html>